package cscie160.hw6;
/**
 * This class is the actual ATM.
 * that has a reference to an instance of a class Account and manipulates its balance.
 * <BR>An instance of ATMImplementation will run on the server. 
 * @author Michael Melnikov 
*/
public class ATMImplementation implements ATM
{
    private Account account; 

    /**
    * no-args constructor creates account with zero balance
    */   
    public ATMImplementation()
    {
        account = new Account();
    }
 
    /**
    * 1-arg constructor creates account with balance equal to its argument
    */   
    public ATMImplementation(float balance) throws ATMException
    {
        this();
        account.deposit(balance);
    }   
    
    /**
    * deposits sum equal to its argument to the account
    */
    public void deposit(float amount) throws ATMException
    {
        account.deposit(amount);
    }
    
    /**
    * withdraws sum equal to its argument off the account
    */    
    public void withdraw(float amount) throws ATMException  
    {
        account.withdraw(amount);    
    }
    
    /**
    * returns balance of the account.
    * Currently we support one account only.
    */
    public Float getBalance() throws ATMException
    {
        return account.getBalance();
    }
}
